package com.communal.dao;

import java.util.Collection;
import java.util.List;

import com.communal.model.BaseEntity;

/**
 * Defines all common DAO methods
 * @author Created by andrey.kuznetsov <br>
 * @author Last modified by $Author$ <br>
 * @author Last modified on $Date$ at revision $Revision$ <br>
 */
public interface IBaseDao {
	
	/**
	 * Save o update entity to database <br>
	 * @param p_obj - entity for save o update; {@link Object} <br>
	 * @return {@link Object}
	 */
	public Object saveOrUpdate(Object p_obj);
	
	public <T> void saveOrUpdateAll(Collection<T> p_obj);
	
	/**
	 * Returns enabled entities of p_class which id's in p_Ids <br>
	 * @param p_class - class of entity; {@link Class} <br>
	 * @param p_Ids - list of id unique nubers; {@link List} <{@link Integer}> <br>
	 * @return list of founded entities; {@link List}<{@link BaseEntity}>
	 */
	@SuppressWarnings("rawtypes")
	public List<BaseEntity> getEnabledEntitiesByIds(Class p_class, List<Integer> p_Ids);
	
	/**
	 * Returns entity of p_class which id equal to p_Id <br>
	 * @param p_class - class of entity; {@link Class} <br>
	 * @param p_Id - unique id of entity; {@link Integer} <br>
	 * @return founded entity; {@link BaseEntity}
	 */
	@SuppressWarnings("rawtypes")
	public BaseEntity getById(Class p_class, Integer p_Id);
	
	/**
	 * Return list of enabled entities <br>
	 * @param <T>
	 * @param p_class - class of entity; {@link Class} <br>
	 * @return list of enabled entities; {@link List}<T>
	 */
	@SuppressWarnings("rawtypes")
	public <T> List<T> getEnabledEntities(Class p_class);
}
